package com.eureka.Controller;//package com.example.utilsm2.controller;

import com.netflix.appinfo.InstanceInfo;
import com.netflix.eureka.EurekaServerContext;
import com.netflix.eureka.registry.PeerAwareInstanceRegistryImpl;
import com.netflix.eureka.resources.PeerReplicationResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.eureka.server.InstanceRegistry;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class DemoController {


//    @Autowired
//    private EurekaServerContext eurekaServerContext;

//    @Autowired
//    private PeerReplicationResource peerReplicationResource;

    @Autowired
    private ApplicationContext applicationContext;

    @PostMapping("/demo")
    public String abc(@RequestParam String abc){
        InstanceRegistry bean = applicationContext.getBean(InstanceRegistry.class);
//        bean.register(InstanceInfo);
        System.out.println(bean);
        return abc;
    }

}
